package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.client.Client02;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 课工场
 * @date 2024/5/6
 * @description
 */
@RestController
@RequestMapping("client01")
@RefreshScope
public class HelloController {


    @Value("${name}")
    private String name;
    @Value("${age}")
    private Integer age;

    @Resource
    private Client02 client02;

    @GetMapping("m1")
    public String method1() {

        String s = client02.method1();

        return "client01 service ok >> client02 >> "+s;
    }


    @GetMapping("m2")
    public String method() {

        return "client01 service ok name = "+name+",age = "+age;
    }
}
